Skip to content

[ENG-9818] - collection search with shtrove#970

Open
Vlad0n20 wants to merge 4 commits intoCenterForOpenScience:feature/es2-consolidationfrom
Vlad0n20:feat/ENG-9818
Open

[ENG-9818] - collection search with shtrove#970
Vlad0n20 wants to merge 4 commits intoCenterForOpenScience:feature/es2-consolidationfrom
Vlad0n20:feat/ENG-9818

Conversation

@Vlad0n20
Copy link
Copy Markdown
Contributor

  • Ticket: [ENG-9818]
  • Feature flag: collectionSubmissionWithCedar (environment config)

Purpose

When the collectionSubmissionWithCedar feature flag is active, switch the collection discover page (/collections/<id>/discover) from the legacy OSF v2 search API to the shtrove API (/trove/index-card-search), reusing the shared GlobalSearchComponent already used by preprint, registry, and institution search pages. If the collection provider has a required_metadata_template, derive additional filter facets from that CEDAR template's fields and append them to the search filter panel.

Summary of Changes

global-search store

  • Added SetExtraFilters action and extraFilters: DiscoverableFilter[] state field (default [])
  • updateResourcesState now merges API-returned filters with extraFilters, deduplicating by key — extra filters survive repeated FetchResources calls
  • ResetSearchState clears extraFilters (included in GLOBAL_SEARCH_STATE_DEFAULTS)

CedarTemplateFilterMapper (new — src/app/shared/mappers/filters/)

  • Static fromTemplate(template: CedarTemplate): DiscoverableFilter[]
  • Iterates _ui.order, skips fields with blank/missing labels, maps each to a DiscoverableFilter with operator: AnyOf
  • Spec covers: normal mapping, empty/whitespace labels, absent keys, order preservation, empty template

CollectionsDiscoverComponent

  • Reads environment.collectionSubmissionWithCedar once at construction as readonly useShtrovSearch
  • In shtrove mode: dispatches SetDefaultFilterValue('isContainedBy', apiDomainUrl/v2/collections/<id>/) to scope trove results to the collection; if provider has requiredMetadataTemplate, maps its fields via CedarTemplateFilterMapper and dispatches SetExtraFilters
  • Template: @if (useShtrovSearch) renders <osf-global-search [searchControlInput]="searchControl" /> (guarded by defaultSearchFiltersInitialized); @else keeps existing <osf-collections-main-content />
  • Legacy effects (getCollectionDetails, URL query sync, debounced search binding) are skipped in shtrove mode
  • On destroy: always calls clearCollections; additionally calls resetSearchState in shtrove mode
  • Refactored monolithic setupEffects() into focused private methods (setupBrandingEffect, setupShtrovSearchEffect, setupCollectionDetailsEffect, setupUrlSyncEffect, setupLegacySearchEffect)

Screenshot(s)

Side Effects

QA Notes

QA Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant